<?php
class system_passport_row extends system_concept_row {
	public function getLogin() {
		return $this->getIdentity();
	}
	public function setLogin($login) {
		return $this->setIdentity($login);
	}
	
	public function getPassword() {
		return $this->getCredential();
	}
	
	public function setPassword($password) {
		return $this->setCredential($password);
	}
	
	public function setCredential($credential) {
		$credential = md5($credential);
		$this->set('credential', $credential);
		return $this;
	}
	
	/**
	 * @return system_passport_concept_row
	 * Enter description here ...
	 * @throws Exception
	 */
	public function save() {
		if($this->getId()) {
			return $this->update();
		}
		$date = new system_date();
		
		$this->setCreationdate($date->get());
		$this->setLastupdate($date->get());
		try {
			$id = $this->getModel('passport')->insert($this->getModelData('passport'));
			$this->setId($id);
			return $this;
		} catch (Exception $e) {
			throw $e;
		}
	}
}